{% from "../../macros/attributes.njk" import govukAttributes %}
{% from "../button/macro.njk" import govukButton %}

{%- set defaultHtml %}
  <span class="govuk-visually-hidden">Emergency</span> Exit this page
{% endset -%}

<div
  {%- if params.id %} id="{{ params.id }}"{% endif %} class="govuk-exit-this-page {%- if params.classes %} {{ params.classes }}{% endif %}" data-module="govuk-exit-this-page"
  {{- govukAttributes(params.attributes) -}}
  {%- if params.activatedText %} data-i18n.activated="{{ params.activatedText | escape }}"{% endif %}
  {%- if params.timedOutText %} data-i18n.timed-out="{{ params.timedOutText | escape }}"{% endif %}
  {%- if params.pressTwoMoreTimesText %} data-i18n.press-two-more-times="{{ params.pressTwoMoreTimesText | escape }}"{% endif %}
  {%- if params.pressOneMoreTimeText %} data-i18n.press-one-more-time="{{ params.pressOneMoreTimeText | escape }}"{% endif %}
>
  {{ govukButton({
    html: params.html if (params.html or params.text) else defaultHtml,
    text: params.text,
    classes: "govuk-button--warning govuk-exit-this-page__button govuk-js-exit-this-page-button",
    href: params.redirectUrl | default("https://www.bbc.co.uk/weather", true),
    attributes: {
      rel: "nofollow noreferrer"
    }
  }) | trim | indent(2) }}
</div>
